import { createRouter, createWebHistory } from 'vue-router'
import User from '../views/Users/User.vue'
import UserHome from '../views/Users/UserHome.vue'
import UserProfile from '../views/Users/UserProfile.vue'
import UserPosts from '../views/Users/UserPosts.vue'
import hello from '../components/HelloWorld.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/users/:username',
      component: User,
      children: [
        { path: '', component: UserHome },

        { path: 'profile', component: UserProfile },

        { path: 'posts', component: UserPosts }
      ]
    },
    {
      path: '/hello',
      component: hello
    },
    {
      path: '/dream',
      component: () => import('../views/YunXi/throttleAadDebounce.vue')
    },
    {
      path: '/cascader',
      component: () => import('../views/InterviewQuestions/cascader.vue')
    },
    {
      path: '/',
      component: () => import('../views/UpLoad/upload.vue')
    },
    {
      path: '/debounce',
      component: () => import('../views/InterviewQuestions/debounce.vue')
    },
    {
      path: '/recursion',
      component: () => import('../views/InterviewQuestions/recursion.vue')
    }
  ]
})

export default router
